#include "memento.h"
#include "originator.h"

int main()
{
    Originator::ptr ori(new Originator(Originator::StateFive,100,100,100));
    CareTaker::ptr taker(new CareTaker);

    taker->addMementor(ori->saveState());
    std::cout<<"保存记录:"<<std::endl;
    ori->displayState();

    ori->setAll(Originator::StateFour,80,80,80);
    taker->addMementor(ori->saveState());
    std::cout<<"保存记录:"<<std::endl;
    ori->displayState();

    ori->setAll(Originator::StateThree,60,60,60);
    taker->addMementor(ori->saveState());
    std::cout<<"保存记录:"<<std::endl;
    ori->displayState();

    ori->setAll(Originator::StateTwo,40,40,40);
    taker->addMementor(ori->saveState());
    std::cout<<"保存记录:"<<std::endl;
    ori->displayState();

    ori->setAll(Originator::StateOne,20,20,20);
    taker->addMementor(ori->saveState());
    std::cout<<"保存记录:"<<std::endl;
    ori->displayState();

    ori->setMemento(taker->preMemento());
    ori->displayState();
    ori->setMemento(taker->preMemento());
    ori->displayState();
    ori->setAll(Originator::StateFour,80,80,80);
    taker->addMementor(ori->saveState());
    ori->displayState();
    ori->setMemento(taker->preMemento());
    return 0;
}